<template>
  <div class="theme-tools">
    <fold :title="'主题'">
      <div>
          暗黑主题:
        <el-switch v-model="darkModeCopy" @change="setTheme"></el-switch>
      </div>
    </fold>
  </div>
</template>

<script>
import Fold from "@/components/common/Fold.vue";
export default {
  components: {
    Fold,
  },
  props: ["darkMode"],
  created(){
      this.darkModeCopy = this.darkMode
  },
  data(){
      return{
          darkModeCopy : false,
      }
  },
  methods:{
      setTheme(){
          let data = {
              darkMode: this.darkModeCopy,
          }
          this.$store.commit("setDarkMode", data)
      }
  }
};
</script>

<style scoped>
    .theme-tools{
        color:white;

        margin-top:5px;
        margin-bottom:5px;
    }
</style>